package stack.era.presentation.main_menu;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.WindowEvent;

import javax.swing.JOptionPane;

import stack.era.constants.FrameAttributes.CardPanel;
import stack.era.constants.FrameAttributes.SideScreen;
import stack.era.domain.DomainController;
import stack.era.presentation.ERAPresentationControl;
import stack.era.presentation.frame.ERAFrame;
import stack.era.presentation.side_screen.SideScreenManager;

public class NewGameControl extends ERAPresentationControl {

	public NewGameControl() {

	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		int result = JOptionPane.showConfirmDialog(ERAFrame.getInstance(),
				"Are you sure you want to overwrite any saved games?",
				"Overwrite saved games?", JOptionPane.YES_NO_OPTION);
		switch (result) {
		case 0:
			// Start new game
			ERAFrame.getInstance().showCard(CardPanel.WORLD_PANEL);
			String name = null;
			while (name == null) {
				name = (String) JOptionPane.showInputDialog(ERAFrame
						.getInstance(), "What is your character's name?",
						"Character Name", JOptionPane.QUESTION_MESSAGE, null,
						null, "Player");
			}
			DomainController.getInstance().startNewGame(name);
			SideScreenManager.getInstance()
					.showSideScreen(SideScreen.CHARACTER);
			break;
		case 1:
			// Do nothing
			break;
		}
	}

	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseMoved(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseWheelMoved(MouseWheelEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyPressed(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyTyped(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowActivated(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowClosed(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowClosing(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowDeactivated(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowDeiconified(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowIconified(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowOpened(WindowEvent e) {
		// TODO Auto-generated method stub

	}

}
